CREATE PROCEDURE RRHH_BUSCAR_ASISTENCIA_L
@IDEMPLEADO INTEGER,
@FECHAINICIO DATETIME,
@FECHAFIN DATETIME
AS

BEGIN TRANSACTION

BEGIN TRY
	SELECT E.idEmpleado, E.nombre, E.apPaterno, E.apMaterno, E.docIdentidad,
		   A.fecha, A.horaEntrada, A.horaSalida
	FROM EMPLEADO E, ASISTENCIADIARIA A
	WHERE E.idEmpleado = A.idEmpleado AND
		  A.idEmpleado = @IDEMPLEADO AND
		  CAST(A.fecha AS DATE) >= CAST(@FECHAINICIO AS DATE) AND
		  CAST(A.fecha AS DATE) <= CAST(@FECHAFIN AS DATE)
	COMMIT TRANSACTION
END TRY
BEGIN CATCH
	ROLLBACK TRANSACTION
END CATCH